package cn.doourbest.learnnetty.learnnetty.util;


public class Main {

    public static void main(String[] args) {

        String name = "C=CN, Inc.\", O\"=TrustAsia Technologies, OU=Domain Validated SSL, CN=TrustAsia TLS RSA CA";

        X500NameTokenizer nTok = new X500NameTokenizer(name);

        while (nTok.hasMoreTokens())
        {
            String  token = nTok.nextToken();

            if (token.indexOf('+') > 0)
            {
            }
            else
            {
                X500NameTokenizer   vTok = new X500NameTokenizer(token, '=');

                String              attr = vTok.nextToken();

               // " Inc.\", O=\"TrustAsia Technologies";
                if (!vTok.hasMoreTokens())
                {
                    throw new IllegalArgumentException("badly formatted directory string");
                }

                String               value = vTok.nextToken();

            }
        }

    }
}

